﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.LeaveCommand;
using System.Security.Cryptography;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.LeaveHanders
{
    public class LeaveUpdateCommandHandler : IRequestHandler<LeaveUpdateCommand, int>
    {
        private readonly ILeaveService _leaveService;
        public LeaveUpdateCommandHandler(ILeaveService leaveService)
        {
            _leaveService = leaveService;
        }

        public async Task<int> Handle(LeaveUpdateCommand request, CancellationToken cancellationToken)
        {
            return await _leaveService.UpdateLeave(new Leave()
            {
                LeaveId=request.LeaveId,
                LeaveName=request.LeaveName,
                Pid=request.Pid,
                LeaveType =request.LeaveType,
                LeaveSdate=request.LeaveSdate,
                LeaveEdate=request.LeaveEdate,
                DateNum = request.DateNum,
                ComeDate = request.ComeDate,
                LeaveReason = request.LeaveReason,
                Rolenames = request.Rolenames,
                addName=request.addName,
                addDate=request.addDate,
                updateName= "王宏",
                updateDate=DateTime.Now,

            });
        }
    }
}
